package com.ershi.spring.component.aware;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Component;

/**
 * @author 二十
 * @since 2021/10/14 11:20 下午
 */
@Component
public class MyAware implements ApplicationContextAware {

	private ApplicationContext ioc ;
	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		ioc = applicationContext;
	}

	public void print(){
		for (String name : ioc.getBeanDefinitionNames()) {
			System.out.println(name);
		}
	}


}
